
{% macro pagination_widget(pagination, endpoint) %}
    <ul class="pagination">
    <li{% if not pagination.has_prev %} class="disabled"{% endif %}>
        <a href="{% if pagination.has_prev %}{{ url_for(endpoint,
        page = pagination.page - 1, **kwargs) }}{% else %}#{% endif %}">
        &laquo;
    </a>
    </li>
        {% for p in pagination.iter_pages() %}
        {% if p %}
        {% if p == pagination.page %}
            <li class="active">
                <a href="{{ url_for(endpoint, page = p, **kwargs) }}">{{ p }}</a>
            </li>
        {% else %}
            <li>
            <a href="{{ url_for(endpoint, page = p, **kwargs) }}">{{ p }}</a>
            </li>
        {% endif %}
    {% else %}
    <li class="disabled"><a href="#">&hellip;</a></li>
        {% endif %}
    {% endfor %}
    <li{% if not pagination.has_next %} class="disabled"{% endif %}>
    <a href="{% if pagination.has_next %}{{ url_for(endpoint,
    page = pagination.page + 1, **kwargs) }}{% else %}#{% endif %}">
    &raquo;
</a>
</li>
</ul>
{% endmacro %}

<!--

{% macro render_pagination(pagination) %}
<div class=pagination>
    {% if pagination.has_prev %}
        <a href="{{ url_for_other_page(pagination.page - 1) }}" class="btn btn-info btn-sm">上一页</a>
    {% endif %}
    {% for page in pagination.iter_pages() %}
        {% if page %}
            {% if page != pagination.page %}
                <a href="{{ url_for_other_page(page) }}" class="btn btn-info btn-sm">{{ page }}</a>
            {% else %}
                <a href="{{ url_for_other_page(page) }}" class="btn btn-info btn-sm" disabled="disabled">{{ page }}</a>
            {% endif %}
        {% else %}
            <span class=ellipsis>…</span>
        {% endif %}
    {% endfor %}
    {% if pagination.has_next %}
        <a href="{{ url_for_other_page(pagination.page + 1) }}" class="btn btn-info btn-sm">下一页</a>
    {% endif %}
</div>
{% endmacro %}

-->
